/*
 * parse.cpp
 *
 *   Created on: 2011-10-3
 *       Author: 左白
 *  Description: parse.h实现
 */

#include "parse.h"
#include <sstream>
using namespace std;

namespace zach
{
string toString( ParseError parseError )
{
	stringstream sstream;
	sstream << parseError.filePath << ":" << parseError.pos.row << ":" << parseError.pos.col << " " << "ErrorNumber:" << parseError.errorNumber << " "
			<< parseError.description;
	return sstream.str();
}

void die( vector<ParseError> errors )
{
	string msg;
	for ( int i = 0, l = errors.size(); i != l; ++i ) {
		msg += toString( errors[i] );
		msg += "\n";
	}
	throw OutOfDomain( msg );
}
}
